import NumberInput from '@/components/form/numberInput/NumberInput.vue';
import TextInput from '@/components/form/textInput/TextInput.vue';
import FlowStatusInput from '@/components/form/FlowStatus/FlowStatusInput.vue';
import EnumInput from '@/components/form/enumInput/EnumInput.vue';
import DateInput from '@/components/form/dateInput/DateInput.vue'
import RadioInput from '@/components/form/radioInput/RadioInput.vue';
import TimeInput from '@/components/form/timeInput/TimeInput.vue';
import CheckInput from '@/components/form/checkInput/CheckInput.vue';
import AttachInput from '@/components/form/attachInput/AttachInput.vue';
import UserInput from '@/components/form/userInput/UserInput.vue';
import DepartInput from '@/components/form/departInput/DepartInput.vue';
import UnitInput from '@/components/form/unitInput/UnitInput.vue';
import TextAreaInput from '@/components/form/textAreaInput/TextAreaInput.vue';

const inputs = {
  TextInput,
  NumberInput,
  DateInput,
  EnumInput,
  RadioInput,
  TimeInput,
  CheckInput,
  AttachInput,
  UserInput,
  DepartInput,
  UnitInput,
  TextAreaInput,
  FlowStatus: FlowStatusInput,
};

export default inputs;

export function resolveTitleField(field) {
  let comp = inputs[field.component];
  if (comp && comp.resolveTitleField) {
    return comp.resolveTitleField(field);
  }
  return field
}

export function resolveFieldType(field) {
  let comp = inputs[field.component];
  if (comp && comp.resolveFieldType) {
    return comp.resolveFieldType(field);
  }
  return 'string'
}
